'use strict';
module.exports = {
	/**
	 * XXXnameXXX
	 * @url client/video/pub/check_LikeAndPay 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid,user_id,series_id,nextseries_id,k } = data;
		let res = { code: 0, msg: "",like_k:false,next_like_k:false };
		// 业务逻辑开始-----------------------------------------------------------

				//判断数据库里是否有点赞记录，有则点亮图标
				const like_k = await db.collection('a_like').where({
					user_id: user_id,
					series_id: series_id,
				}).count()
				if (like_k.total > 0) {
					res.like_k = true
				}
				
				
				//加载下一个视频的点赞状态
				const next_like_k = await db.collection('a_like').where({
					user_id: user_id,
					series_id: nextseries_id,
				}).count()

				if (next_like_k.total > 0) {
					res.next_like_k = true
				}
				//判断数据库点赞记录结束


		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
